package com.ddf.springdata.jpa.config;

import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

import java.time.LocalDateTime;
import java.util.Optional;

/**
 * @author DDf on 2018/9/30
 * @see MainConfiguration#auditorProvider()
 * @see EnableJpaAuditing
 * @see com.ddf.springdata.jpa.entity.BaseDomain
 * @see CreatedBy
 * @see LastModifiedBy
 */
public class MyAuditAware implements AuditorAware<String> {
    @Override
    public Optional<String> getCurrentAuditor() {
        return Optional.of("dongfang.ding" + LocalDateTime.now().toString());
    }
}
